import { createStackNavigator, TransitionPresets } from '@react-navigation/stack'
import { MyTabbar } from '@/pages/Tabbar'
import { lazy } from 'react'
import Welcome from '@/pages/Welcome/Welcome'
import Article from '@/pages/Article/Article'

const Stack = createStackNavigator()

const Login = lazy(() => import('@/pages/Login/Login'))
const Publish = lazy(() => import('@/pages/Tabbar/publish/Publish'))
// const Article = lazy(() => import('@/pages/Article/Article'))
const SearchGoods = lazy(() => import('@/pages/SearchGoods/SearchGoods'))

export const MyStack = () => {
  return (
    <Stack.Navigator initialRouteName="MyTabbar">
      {/* 路由页面 */}
      <Stack.Screen
        component={Welcome}
        name="Welcome"
        options={{
          headerShown: false
        }}
      ></Stack.Screen>
      <Stack.Screen
        component={Login}
        name="Login"
        options={{
          headerShown: false,
          ...TransitionPresets.SlideFromRightIOS
        }}
      ></Stack.Screen>
      <Stack.Screen
        name="MyTabbar"
        component={MyTabbar}
        options={{
          headerShown: false
        }}
      ></Stack.Screen>
      <Stack.Screen
        name="Publish"
        component={Publish}
        options={{
          ...TransitionPresets.BottomSheetAndroid,
          title: '查看图片信息'
        }}
      ></Stack.Screen>
      <Stack.Screen
        name="Article"
        component={Article}
        options={{
          ...TransitionPresets.SlideFromRightIOS,
          headerShown: false
        }}
      ></Stack.Screen>
      <Stack.Screen
        name="SearchGoods"
        component={SearchGoods}
        options={{
          headerShown: false,
          // 呈现配置
          ...TransitionPresets.ModalFadeTransition
        }}
      ></Stack.Screen>
    </Stack.Navigator>
  )
}
